package jiaxa.com.jsbridge.amap;

import com.amap.api.location.AMapLocation;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by jiaxa on 2017/11/21.
 */

public class AMapBean {
    /**
     * locationType :
     * latitude :
     * longitude :
     * address :
     * country :
     * province :
     * city :
     * district :
     * street :
     * streetNum :
     * cityCode :
     * adCode :
     * gpsStatus :
     * errorInfo :
     * errorCode :
     */

    private int locationType;
    private String locationTime;
    private double latitude;
    private double longitude;
    private String address;
    private String country;
    private String province;
    private String city;
    private String district;
    private String street;
    private String streetNum;
    private String cityCode;
    private String adCode;
    private String gpsStatus;
    private String errorInfo;
    private int errorCode;

    public AMapBean(){}

    public AMapBean(AMapLocation location){
        this.locationType=location.getLocationType();
        this.latitude=location.getLatitude();//获取纬度
        this.longitude=location.getLongitude();//获取经度
        this.address=location.getAddress();//地址，如果option中设置isNeedAddress为false，则没有此结果，网络定位结果中会有地址信息，GPS定位不返回地址信息。
        this.country=location.getCountry();//国家信息
        this.province=location.getProvince();//省信息
        this.city=location.getCity();//城市信息
        this.district=location.getDistrict();//城区信息
        this.street=location.getStreet();//街道信息
        this.streetNum=location.getStreetNum();//街道门牌号信息
        this.cityCode=location.getCityCode();//城市编码
        this.adCode=location.getAdCode();//地区编码
        this.errorCode=location.getErrorCode();
        this.errorInfo=location.getErrorInfo();
        //aMapLocation.getAccuracy();//获取精度信息
        //aMapLocation.getAoiName();//获取当前定位点的AOI信息
        //aMapLocation.getBuildingId();//获取当前室内定位的建筑物Id
        //aMapLocation.getFloor();//获取当前室内定位的楼层
        //aMapLocation.getGpsStatus();//获取GPS的当前状态

        Date date=new Date(location.getTime());
        String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
        this.locationTime=formatDate;
    }

    public String getLocationTime() {
        return locationTime;
    }

    public void setLocationTime(String locationTime) {
        this.locationTime = locationTime;
    }


    public int getLocationType() {
        return locationType;
    }

    public void setLocationType(int locationType) {
        this.locationType = locationType;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getStreetNum() {
        return streetNum;
    }

    public void setStreetNum(String streetNum) {
        this.streetNum = streetNum;
    }

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getAdCode() {
        return adCode;
    }

    public void setAdCode(String adCode) {
        this.adCode = adCode;
    }

    public String getGpsStatus() {
        return gpsStatus;
    }

    public void setGpsStatus(String gpsStatus) {
        this.gpsStatus = gpsStatus;
    }

    public String getErrorInfo() {
        return errorInfo;
    }

    public void setErrorInfo(String errorInfo) {
        this.errorInfo = errorInfo;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}
